|
|
|
|
|
|
|
systems are quite different. You can even access a number of PC databases using ODBC functions. |
|
|
|
|
|
|
|
|
Understanding ODBC Drivers |
|
|
|
|
|
|
|
|
ODBC drivers are the DLLs containing the functions that let you connect to various databases. There are separate drivers for each database type. For many standard formats, such as PC databases and SQL Servers, these drivers are provided with Visual Basic. For other databases, the ODBC driver is provided by the server manufacturer. |
|
|
|
|
|
|
|
|
|
If you use ODBC in your application, make sure the appropriate drivers are distributed with your application. If you selected the Redistributable ODBC option when installing VB, an ODBC subdirectory should have been created in the Visual Basic program directory. Running SETUP.EXE installs ODBC drivers, although you still have to set up your data sources.  |
|
|
|
|
|
|
|
|
|
|
ODBC drivers can be one of two types: single-tier or multiple-tier. A single-tier driver is used to connect to PC-based database systems that may reside on either the local machine or a file server. Multiple-tier drivers are used to connect to client/server databases where the SQL statement is processed by the server, not the local machine. |
|
|
|
|
|
|
|
|
Each ODBC driver you encounter must contain a basic set of functions, known as the core-level capabilities. These basic functions are as follows: |
|
|
|
|
|
|
|
|
Providing database connections |
|
|
|
|
|
|
|
|
Preparing and executing SQL statements |
|
|
|
|
|
|
|
|
Informing the application of errors |
|
|
|
|
|
|
|
|
Setting Up an ODBC Data Source |
|
|
|
|
|
|
|
|
Before you can use ODBC to connect to a database, you must make sure of two things: |
|
|
|
|
|
|
|
|
The ODBC drivers are installed on your system. |
|
|
|
|
|
|
|
|
You have set up the ODBC data source. |
|
|
|
|
|
|
|
|
Both of these functions can be accomplished by using the ODBC Manager application. Also, the second function can be accomplished from code, by using the data access objects. Remember, an ODBC driver is used to connect to a type of database, for example, SQL Server. An ODBC Data Source is a configuration of an ODBC driver used to connect to a specific database, for example, Accounting Department Database. |
|
|
|
|
|
|
|
|
|
On Microsoft Windows 95 and 98 systems, you will find the ODBC manager in the Control Panel, under the Settings item on the Start menu. The icon you are looking for is labeled "32-bit ODBC." You might also have an icon called "ODBC" if you have some older 16-bit programs. |
|
|
|
|
|
|
|